
import { defineStore } from 'pinia'
import { usePreferredDark, usePreferredLanguages } from '@vueuse/core'
export function formatLang(lang=window.navigator.language):string {
  const sarr=lang.split('-')
  const [f,s]=sarr
  return [f,s.charAt(0).toUpperCase()+s.slice(1)].join('')
}
export const useSystemStore = defineStore('system', () => {
  const darkMod = usePreferredDark()
  const languages = usePreferredLanguages()
  // const language = window.navigator.language.split('-')
  return { darkMod, language:formatLang(), languages }
})
